package cn.shadow.module.login;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;

public class MyButton extends Button {


    public MyButton(TextureRegion up, TextureRegion down) {
        init(up, down);
    }

    public void init(TextureRegion up, TextureRegion down) {
        Button.ButtonStyle style = new Button.ButtonStyle();
        style.up = new TextureRegionDrawable(up);
        style.down = new TextureRegionDrawable(down);
        setStyle(style);
    }

    public MyButton(String up,String down) {
        TextureRegion upTexture = new TextureRegion(new Texture(Gdx.files.internal(up)));
        TextureRegion downTexture = new TextureRegion(new Texture(Gdx.files.internal(down)));
        init(upTexture, downTexture);
    }

}
